Imports System.Data.SqlClient

Public Class EstadisticaPropiedadesPorBarrio
    Dim da As New DataAccess
    Private Sub EstadisticaPropiedadesPorBarrio_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim cmd As New SqlCommand


        Dim tabla As New Data.DataTable
        tabla = da.consultarSQL("SELECT  top 10 count (*)as cantidad, Barrios.descripcion as barrio FROM Barrios INNER JOIN Localidades ON Barrios.idLocalidad = Localidades.idLocalidad INNER JOIN Provincias ON Localidades.idProvincia = Provincias.idProvincia INNER JOIN Propiedades ON Barrios.idBarrio = Propiedades.idBarrio group by  Barrios.descripcion order by 1 desc")
        Dim cantidad = tabla.Rows.Count
        Dim i As Integer
        Dim acu = 0
        For i = 0 To cantidad - 1
            acu += tabla.Rows(i).Item("cantidad")
        Next

        Me.Label1.Text = tabla.Rows(0).Item("barrio")
        Me.p1.Increment(100 * (Convert.ToDouble(tabla.Rows(0).Item("cantidad")) / Convert.ToDouble(acu)))
        Me.Label2.Text = tabla.Rows(1).Item("barrio")
        Me.p2.Increment(100 * (Convert.ToDouble(tabla.Rows(1).Item("cantidad")) / Convert.ToDouble(acu)))
        Me.Label3.Text = tabla.Rows(2).Item("barrio")
        Me.p3.Increment(100 * (Convert.ToDouble(tabla.Rows(2).Item("cantidad")) / Convert.ToDouble(acu)))
        Me.Label4.Text = tabla.Rows(3).Item("barrio")
        Me.p4.Increment(100 * (Convert.ToDouble(tabla.Rows(3).Item("cantidad")) / Convert.ToDouble(acu)))
        Me.Label5.Text = tabla.Rows(4).Item("barrio")
        Me.p5.Increment(100 * (Convert.ToDouble(tabla.Rows(4).Item("cantidad")) / Convert.ToDouble(acu)))
        Me.Label6.Text = tabla.Rows(5).Item("barrio")
        Me.p6.Increment(100 * (Convert.ToDouble(tabla.Rows(5).Item("cantidad")) / Convert.ToDouble(acu)))
        Me.Label7.Text = tabla.Rows(6).Item("barrio")
        Me.p7.Increment(100 * (Convert.ToDouble(tabla.Rows(6).Item("cantidad")) / Convert.ToDouble(acu)))
        Me.Label8.Text = tabla.Rows(7).Item("barrio")
        Me.p8.Increment(100 * (Convert.ToDouble(tabla.Rows(7).Item("cantidad")) / Convert.ToDouble(acu)))
        Me.Label9.Text = tabla.Rows(8).Item("barrio")
        Me.p9.Increment(100 * (Convert.ToDouble(tabla.Rows(8).Item("cantidad")) / Convert.ToDouble(acu)))
        Me.Label10.Text = tabla.Rows(9).Item("barrio")
        Me.p10.Increment(100 * (Convert.ToDouble(tabla.Rows(9).Item("cantidad")) / Convert.ToDouble(acu)))

    End Sub


    Private Sub ProgressBar8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles p5.Click

    End Sub
End Class